<?php
class Zone{
	private $setter;
	private $dbOperator;
	
	private $id;
	private $nombre;
	
	function Zone(){
		$this->setter=new Setter("../../Config");
		$this->dbOperator=new DbOperator($this->setter->getDataBaseHost(),$this->setter->getDataBaseUserName(),$this->setter->getDataBaseName(),$this->setter->getDataBasePassword());
		$this->id="";
		$this->nombre="";
	}
	
	function setId($id=""){
		$this->id=$id;
	}
	function getId(){
		return $this->id;
	}
		
	function setNombre($nombre=""){
		$this->nombre=$nombre;
	}
	function getNombre(){
		return $this->nombre;
	}
	
		
	function guardar(){
		$this->dbOperator->connect();
		//Guardar en la tabla roles
		$this->dbOperator->dbInsert(array("",$this->nombre),"zonas");
	}
	function eliminar(){
		$this->dbOperator->connect();
		$this->dbOperator->erase("zonas","id",$this->id);			
	}
 	
	function cargar($idZone="0"){
		$this->dbOperator->connect();
		$dataZone=$this->dbOperator->consult("SELECT * FROM zonas WHERE id='".$idZone."'","yes");
		$this->id=$dataZone[0];
		$this->nombre=$dataZone[1];
	}
}
?>
